#include <stdarg.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <resolv.h>
#include <errno.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <stdlib.h>
#include <stddef.h>

/*
  Global
  constants
 */

#define MAXBUF 1024

#define SERVERS 10

#define PORT 33000

#define BACKLOG 1024

#define LISTENQ 1024   /*  Backlog for listen()   */

#define MAX_CLIENTS 20000
#define MAX_MEMBERS 500
#define MAX_GROUPS 50

#define FILENAME "/home/karim/test.jpg"
#define FILENAME2 "/home/karim/reception/test2.jpg"


typedef struct client
{
	int fd;
	char*  pseudo;
	int type;
} client_t;


typedef struct group
{
	int num_members;
	client_t owner;
	client_t members[MAX_MEMBERS];
} group_t;

ssize_t Sendline(int sockd, const void *vptr, size_t n);
ssize_t Readline(int sockd, void *vptr, size_t maxlen);
size_t minChar (int i, int j);
void create_socket_connect(char* ip, char* port, int* fd);
client_t* find_nickname(client_t client[MAX_CLIENTS], char buffer[MAXBUF]);
